#ifndef IMAGEMAP_C
#define IMAGEMAP_C



#define  BYTE0(x)    (uint8_t) ((x) % 0x100)

#define  IMAGE_OFFSET(GridNumber, ByteOffset)   (GridNumber + ByteOffset)

#ifdef TABLE_STATE
uint8_t const IMAGE_PROMPT_INDEX[] =
{
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(0,0),
	IMAGE_OFFSET(1,0),
	
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(2,0),
	IMAGE_OFFSET(3,0),
};

uint8_t const IMAGE_PROMPT_MASK[] = 
{
	0x01,
	0x02,
	0x04,
	0x08,
	0x10,
	0x20,
	0x40,
	0x01,
	
	0x01,
	0x02,
	0x04,
	0x08,
	0x10,
	0x20,
	0x40,
	0x02,
};
#else
//extern uint8_t const IMAGE_PROMPT_INDEX[];
//extern uint8_t const IMAGE_PROMPT_MASK[];
#endif

/*----------------------------------*
 |  7-Segment image patterns
 *----------------------------------*/

/*----------------------------------------------------------------------* 
 |  Use the following segment-naming scheme to define the patterns for
 |  the 7-segment alphanumeric display
 |
 |                          ---A---
 |                         |       |
 |                         F       B
 |                         |       |
 |                          ---G---
 |                         |       |
 |                         E       C
 |                         |       |
 |                          ---D---
 *----------------------------------------------------------------------*/
#define A    0x01    /* Q0 of D-latch output */
#define B    0x02    /* Q1 of D-latch output */
#define C    0x04    /* Q2 of D-latch output */
#define D    0x08    /* Q7 of D-latch output */
#define E    0x10    /* Q6 of D-latch output */
#define F    0x20    /* Q4 of D-latch output */
#define G    0x40    /* Q5 of D-latch output */
#define DOT  0x80    /* Q3 of D-latch output */

#define  PATTERN_0      (A + B + C + D + E + F)       /* 0 */
#define  PATTERN_1      (B + C)                       /* 1 */
#define  PATTERN_2      (A + B + D + E + G)           /* 2 */
#define  PATTERN_3      (A + B + C + D + G)           /* 3 */
#define  PATTERN_4      (B + C + F + G)               /* 4 */
#define  PATTERN_5      (A + C + D + F + G)           /* 5 */
#define  PATTERN_6      (A + C + D + E + F + G)       /* 6 */
#define  PATTERN_7      (A + B + C)                   /* 7 */
#define  PATTERN_8      (A + B + C + D + E + F + G)   /* 8 */
#define  PATTERN_9      (A + B + C + D + F + G)       /* 9 */
#define  PATTERN_BLANK  (0)                           /*   */
#define  PATTERN_DASH   (G)                           /* - */
#define  PATTERN_A      (A + B + C + E + F + G)       /* A */
#define  PATTERN_b      (C + D + E + F + G)           /* b */
#define  PATTERN_C      (A + F + E + D)               /* C */ 
#define  PATTERN_c      (G + E + D)                   /* c */
#define  PATTERN_d      (B + C + D + E + G)           /* d */ 
#define  PATTERN_E      (A + D + E + F + G)           /* E */
#define  PATTERN_F      (A + E + F + G)               /* F */
#define  PATTERN_G      (A + B + C + D + F + G)       /* 9 */
#define  PATTERN_H      (B + C + E + F + G)           /* H */
#define  PATTERN_h      (C + E + F + G)               /* h */
#define  PATTERN_I      (E + F)                       /* I */
#define  PATTERN_i      (E)                           /* i */
#define  PATTERN_J      (B + C + D)                   /* J */
#define  PATTERN_K		(F + E + G)							/* K */
#define  PATTERN_L      (D + E + F)                   /* L */
#define  PATTERN_M		(A + B + C + E + F)				/* M */
#define  PATTERN_N      (A + B + C + E + F)              /* n */
#define  PATTERN_n      (C + E + G)                   /* n */
#define  PATTERN_O      PATTERN_0
#define  PATTERN_o      (C + D + E + G)               /* o */
#define  PATTERN_P      (A + B + E + F + G)           /* P */
#define  PATTERN_Q      (A + B + C + F + G)           /* Q */
#define  PATTERN_r      (E + G)                       /* r */
#define  PATTERN_S		PATTERN_5							/* S */
#define  PATTERN_t      (D + E + F + G)               /* t */
#define  PATTERN_U      (B + C + D + E + F)           /* U */
#define  PATTERN_u      (C + D + E)                   /* u */
#define	PATTERN_v	   (C + D + E)							/* v */
#define	PATTERN_W	   (C + D + E)							/* W */
#define	PATTERN_X	   (C + D + E)							/* X */
#define	PATTERN_Y	   (B + C + D + F + G)				/* Y */
#define	PATTERN_Z	   (A + D + G)							/* Z */


#define  PATTERN__1      (D)
#define  PATTERN__2      (G)
#define  PATTERN__3      (A)

#define  PATTERN_DEGREE    (A + B + F + G)


#define  PATTERN_MASK   (A + B + C + D + E + F + G)   /* ALL ON */





#define DIGITAL_0          0
#define DIGITAL_1          1
#define DIGITAL_2          2
#define DIGITAL_3          3
#define DIGITAL_4          4
#define DIGITAL_5          5
#define DIGITAL_6          6
#define DIGITAL_7          7
#define DIGITAL_8          8
#define DIGITAL_9          9

#define DIGITAL_BLANK      11
#define DIGITAL_A          13
#define DIGITAL_b          14
#define DIGITAL_C          15
#define DIGITAL_d          16
#define DIGITAL_E          17
#define DIGITAL_F          18
#define DIGITAL_G          19
#define DIGITAL_H          20
#define DIGITAL_i          21
#define DIGITAL_J          22
#define DIGITAL_K          23
#define DIGITAL_L          24
#define DIGITAL_M          25
#define DIGITAL_n          26
#define DIGITAL_o          27
#define DIGITAL_P          28
#define DIGITAL_Q          29
#define DIGITAL_r          30
#define DIGITAL_S          31
#define DIGITAL_t          32
#define DIGITAL_U          33
#define DIGITAL_v          34
#define DIGITAL_W          35
#define DIGITAL_X          36
#define DIGITAL_Y          37
#define DIGITAL_Z          38


#define DIGITAL__1         39
#define DIGITAL__2         40
#define DIGITAL__3         41

#define DIGITAL_I          42
#define DIGITAL_u          43
#define DIGITAL_h          44
#define DIGITAL_N          45
#define DIGITAL_DEGREE     46


#endif